﻿using BroadGoalComponents.Dialogs;
using Custom.Infrastructure.EventBus;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Custom.Controls
{
    public partial class PopupFormWithCover : DialogBase
    {
        public PopupFormWithCover()
        {
            InitializeComponent();

            EventBus.Instance.Publish(new TEventEntity()
            {
                ActionName = "showCover"
            }, CallBack);

            this.MinimizeBox = false;
            this.MaximizeBox = false;
            this.BackColor = Color.White;
            this.Font = new Font("微软雅黑", 12, GraphicsUnit.Pixel);
            this.ShowInTaskbar = false;
        }

        protected virtual void CallBack(TEventEntity entity, bool result, Exception ex)
        {

        }

        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x112)
            {
                if (m.WParam.ToInt32() == 61539 || m.WParam.ToInt32() == 61587) return;
            }
            base.WndProc(ref m);
        }

        private void BaseFormWithCover_FormClosed(object sender, FormClosedEventArgs e)
        {
            EventBus.Instance.Publish(new TEventEntity()
            {
                ActionName = "hideCover"
            }, CallBack);
        }
    }
}
